package com.aistar.hotel.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Created by wubin on 2019/7/2.
 */
public interface HotelCollectMapper {
    @Select("select user_id from collect where hotel_id= #{id}")
   List<String> findByUserId(String id);

    @Select("select collect_id from collect where hotel_id = #{hid} and user_id = #{uid}")
    String findcollectId(@Param("hid") String hid,@Param("uid") String uid);

    @Insert("insert into collect values(#{cid},#{uid},#{hid})")
    Boolean save(@Param("cid") String cid,@Param("uid") String uid,@Param("hid") String hid);


    @Delete("delete from collect where hotel_id=#{hid} and user_id = #{uid}")
    Boolean delUser(@Param("hid") String hid,@Param("uid") String uid);


//    根据当前用户的Id查询出对应的收藏的酒店的id
    @Select("select hotel_id from collect where user_id =#{userId}")
    List<String> findByUId(String id);
}
